import http from "@/api";
import type { GoodsItemModel } from "@/api/modules/goods";

export interface MyGoodsRateGetListSendModel {
	page: number;
	size: number;
	goodsId: number | string | null;
}
export interface MyGoodsRateGetListItem {
	id: number;
	userId: number;
	orderId: string;
	adminId: number;
	goodsId: number;
	description: string;
	count: number;
	createTime: number;
	updateTime: number;
	goods: GoodsItemModel;
	reply: ReplyItemModel;
	user: { userName: string; avatar: string };
	admin: { userName: string; avatar: string };
}
export interface MyGoodsRateGetListReturnModel {
	total: number;
	pageNum: number;
	page: number;
	size: number;
	list: MyGoodsRateGetListItem[];
}
/** 获取评论列表  */
export function myGoodsRateGetList(params: MyGoodsRateGetListSendModel) {
	return http.get<MyGoodsRateGetListReturnModel>("/myGoodsRate/getList", params);
}

interface MyGoodsRateReplyCommentsSendModel {
	parentId: number;
	type: string;
	adminId: number;
	userId: number;
	goodsId: number;
	description: string;
}
/** 回复用户评论  */
export function myGoodsRateReplyComments(data: MyGoodsRateReplyCommentsSendModel) {
	return http.post("/myGoodsRate/replyComments", data);
}

// 回复信息数据item
interface ReplyItemModel {
	id: number;
	parentId: number;
	type: string;
	adminId: number;
	userId: number;
	goodsId: number;
	description: string;
	createTime: number;
	updateTime: number;
}
